package com.PAT.practice01;

import java.util.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2021/11/22/14:51
 * @Description:
 * @Target:
 */
public class 朋友数 {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int size = scanner.nextInt();
        Set set = new TreeSet(); //


        while (size-->0){
            String ss = scanner.next();
            set.add(GetIntByString(ss));
        }

        System.out.println(set.size());
        Object[] objects = set.toArray();
        for (int i = 0; i <= objects.length-1; i++) {
            if (i!=objects.length-1){
                System.out.print(objects[i]+" ");
            }else {
                System.out.print(objects[i]);
            }
        }


    }

    // 设置一个方法,入参字符串,字符串中数字进行计算,出参int
    public static int GetIntByString(String ss){
        int sum = 0;

        for (int i = 0; i <= ss.length()-1; i++) {
            if(ss.charAt(i)>='0'&&ss.charAt(i)<='9'){
                sum+=(ss.charAt(i)-'0');
            }
        }

        return sum;
    }





}
